package com.vt.service;

import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.core.UriBuilder;

import com.sun.grizzly.http.SelectorThread;
import com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory;

public class Server {

	protected static SelectorThread startServer() throws IOException {
		final Map<String,String> initParams = new HashMap<String,String>();
		initParams.put("com.sun.jersey.config.property.packages","com.vt.service");
		System.out.println("Starting Server Gizzly ....");
		URI uri = UriBuilder.fromUri("http://localhost/").port(2000).build();
		SelectorThread threadselector = GrizzlyWebContainerFactory.create(uri,initParams);
		return threadselector;
		
	}
	
	public static void main (String [] args )throws IOException {
		SelectorThread thread  = startServer();
		System.in.read();
		thread.stopEndpoint();
	}
}
